package com.atguigu.cloud.IO;


import com.atguigu.cloud.pojo.Model;
import com.sun.org.apache.xpath.internal.operations.Mod;

import java.io.*;

public class IOTest {
    public static void main(String[] args) {
        // Model m = new Model("test");
        //
        // File outFile = new File("saveFileName");
        //
        // try {
        //     ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(outFile));
        //     out.writeObject(m);
        //     out.close();
        // } catch (IOException e) {
        //     throw new RuntimeException(e);
        // }
        File file = new File("saveFileName");
        try {
            ObjectInputStream input = new ObjectInputStream(new FileInputStream(file));
            Model model = (Model) input.readObject();
            System.out.println(model.getModelName());
            input.close();
        } catch (IOException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
